package 力扣算法练习.main1.newPart1;

public class day11 {
    //https://www.nowcoder.com/practice/7299c12e6abb437c87ad3e712383ff84?tpId=37&tqId=21279&ru=/exam/oj
    public void ferfect(int number) {
        int temp = 0;
        for (int i = 1; i <= number; i++) {
            if (findPerfect(i) != -1) {
                temp++;
            }
        }
        System.out.println(temp);
    }

    private static int findPerfect(int number) {
        int sum = 0;
        for (int i = 1; i <= (number >> 1); i++) {
            if (number % i == 0) {
                sum += i;
            }
        }
        if (sum == number) {
            return 1;
        }
        return -1;
    }
}
